package cn.smxy.admin.excel;

import cn.smxy.admin.pojo.AdminUser;
import cn.smxy.util.DateFormatUtil;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
//@ContentStyle(dataFormat = 49)
public class AdminUserExcel implements Serializable {
    private static final long serialVersionUID = 8423873386829251901L;

    @ExcelProperty("管理员编号")
    private String adminId;

    @ExcelProperty("名称")
    private String adminName;

    @ExcelProperty("账号")
    private String adminAccount;

    @ExcelProperty("密码")
    private String adminPassword;

    @ExcelProperty("手机号")
    private String adminPhone;

    @ExcelProperty("创建时间")
    private String createTime;

    @ExcelProperty("管理员权限")
    private Integer adminRole;

    public AdminUserExcel(AdminUser adminUser) {
        this.adminId = adminUser.getAdminId().toString();
        this.adminName = adminUser.getAdminName();
        this.adminAccount = adminUser.getAdminAccount();
        this.adminPassword = adminUser.getAdminPassword();
        this.adminPhone = adminUser.getAdminPhone();
        this.createTime = DateFormatUtil.dateFormat(adminUser.getCreateTime());
        this.adminRole = adminUser.getAdminRole();
    }
}

